/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package javaapplication51;

/**
 *
 * @author Jenny
 */
public class JavaApplication51 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        exam_func(2, 25);
        // TODO code application logic here
    }

    public static int exam_func(int a, int b) {
        if (b == 0) {
            return 0;
        } else if (b % 2 == 0) {
            return exam_func(a + a, b / 2);
        } else {
            return exam_func(a + a, b / 2) + a;
        }
    }
}
